package com.edu.exam.enums.assessment.generation;

/**
 * 配置状态枚举
 *
 * @author System
 * @version 1.0.0
 */
public enum ConfigStatus {
    DRAFT("DRAFT", "草稿"),
    ACTIVE("ACTIVE", "生效"),
    INACTIVE("INACTIVE", "失效"),
    PENDING("PENDING", "待审核"),
    APPROVED("APPROVED", "已审核"),
    REJECTED("REJECTED", "已拒绝"),
    ARCHIVED("ARCHIVED", "已归档"),
    SUSPENDED("SUSPENDED", "已暂停"),
    CANCELLED("CANCELLED", "已取消"),
    EXPIRED("EXPIRED", "已过期");

    private final String code;
    private final String description;

    ConfigStatus(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static ConfigStatus fromCode(String code) {
        for (ConfigStatus status : ConfigStatus.values()) {
            if (status.code.equals(code)) {
                return status;
            }
        }
        throw new IllegalArgumentException("Unknown config status code: " + code);
    }

    @Override
    public String toString() {
        return description;
    }
}